package com.zzzzzz.account.model;

import java.text.ParseException;
import java.text.SimpleDateFormat;

import com.zzzzzz.common.util.Validator;

public class EditProfileVo {

	private String firstName;
	
	private String lastName;
	
	private String username;

	private String aboutMe;
	
	private String day;
	
	private String month;
	
	private String year;

	private String gender;

	public String getFirstName() {
		return firstName;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	public String getLastName() {
		return lastName;
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getAboutMe() {
		return aboutMe;
	}

	public void setAboutMe(String aboutMe) {
		this.aboutMe = aboutMe;
	}

	public String getDay() {
		return day;
	}

	public void setDay(String day) {
		this.day = day;
	}

	public String getMonth() {
		return month;
	}

	public void setMonth(String month) {
		this.month = month;
	}

	public String getYear() {
		return year;
	}

	public void setYear(String year) {
		this.year = year;
	}

	public String getGender() {
		return gender;
	}

	public void setGender(String gender) {
		this.gender = gender;
	}
	
	public void updatePo(User user) throws ParseException {

		user.setFirstName(this.getFirstName());
		user.setLastName(this.getLastName());
		user.setUsername(this.getUsername());
		user.setAboutMe(this.getAboutMe());
		user.setGender(this.getGender());
		if(Validator.isNotNull(this.getYear()) && Validator.isNotNull(this.getMonth()) && Validator.isNotNull(this.getDay())) {
			String dob_str = this.getYear() + "-" + this.getMonth() + "-" + this.getDay();
			user.setDob(format.parse(dob_str));
		}
	}
	
	private static SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
	
}
